def four(x):
	x.sort()
	x.reverse()
	quarter=sum(x)/4

	def fi(sofar,remind):
		sumsofar=sum(sofar)
		if sumsofar==quarter:
			if remind==[]:
				return [sofar]
			result=fi([remind[0]],remind[1:])
			if result:
				return [sofar]+result
			return
		for i in range(len(remind)):
			if sumsofar+remind[i]>quarter:
				continue
			result=fi(sofar+[remind[i]],remind[:i]+remind[i+1:])
			if result:
				return result
	if quarter*4==sum(x):
		return fi([x[0]],x[1:])

print four([8,1,7,2,6,4,4,3,5])
print four([1,3,2,2,4,3,3])
print four([8,4,4,8,4,3,2])
print four([8,4,4,8,6,1,1])
print four([2,3,5,1,2,2,4,1])
print four([2,13,5,1,22,2,4,1])
print four([4,4,2,6])
print four([3,1,3,1,3,1,3,1,3,1])
s=input()
